package com.suixinsanren.design.adapter.demo04;

import org.junit.Test;

public class BirdTestDrive {

    private final Duck duck = new MallardDuck();
    private final Turkey turkey = new WildTurkey();

    @Test
    public void normalTest() {
        testDuck(duck);
        testTurkey(turkey);
    }

    @Test
    public void duckAdapterTest() {
        testTurkey(new TurkeyAndDuckAdapter(duck));
    }

    @Test
    public void turkeyAdapterTest() {
        testDuck(new TurkeyAndDuckAdapter(turkey));
    }

    public void testDuck(Duck duck) {
        System.out.println("鸭子测试:");
        duck.quack();
        duck.fly();
    }

    public void testTurkey(Turkey turkey) {
        System.out.println("火鸡测试:");
        turkey.gobble();
        turkey.fly();
    }
}
